import sys
import chardet

# 当前字符编码
print(sys.getdefaultencoding())


# 打开文件
file = open(r"README", 'r', encoding='utf-8')
file2 = open(r"README2", 'w', encoding='utf-8')  # w参数会删除原有，即使没有任何操作。也会清空文件。类似于shell的【 > 文件名】

# 读取整个
# data = file.read()

data = ""

while True:
    # 逐行读取
    text = file.readline()
    if not text:
        break
    data += text
    file2.write(text)

print(data)
print('测试')

file.close()

# ---------------------------------------- #

file = open(r"README", "a")





